package com.lichungang.util;

import java.io.InputStream;
import java.util.Properties;

public class ReadProperties {

	private static ReadProperties rp;
	
	public String dbUrl;
	public String dbUserName;
	public String dbPassword;
	
	private ReadProperties() {
		loadProperties();
		}
	public static ReadProperties initial() {
		if(rp==null)
			rp = new ReadProperties();
		return rp;
	}
	
	private void loadProperties() {
		InputStream ips = getClass().getResourceAsStream("/db.properties");
		Properties properties = new Properties();
		
		try {
			properties.load(ips);
			this.dbUrl = properties.getProperty("dbUrl");
			this.dbUserName = properties.getProperty("dbUserName");
			this.dbPassword = properties.getProperty("dbPassword");
			
		}
		catch(Exception e) {
			e.printStackTrace();
		}
	}
}
